package com.lx.controller;

import com.lx.custom.AjaxException;
import com.lx.custom.WebException;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 同一异常拦截
 *
 * @author 段誉
 * @create 2019-03-19 16:18
 */
@Controller
@RequestMapping("/exception")
public class ExceptionController {
  /**
   * @desc ajax异常
   * @Author 段誉
   * @Date 2019/3/19 16:33
   * @method
   */
  @GetMapping("/home1")
  public String home1() {
    throw new AjaxException(110, "ajax异常");
  }

  /**
   * @desc 网页异常
   * @Author 段誉
   * @Date 2019/3/19 16:34
   * @method
   */
  @GetMapping("/home2")
  public String home2() {
    int a = 10;
    int b = 4;
    System.out.println(++a*b);
    throw new WebException(120, "网页异常");
  }

}
